from django.db import models
from django.contrib.auth.models import AbstractUser
from apps.common.base.models import BaseModel
from apps.system.lessee.models import Lessee

class Account(AbstractUser, BaseModel):

    lessee = models.ForeignKey(Lessee, related_name="lessee_account", verbose_name='租户', on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    parent=models.ForeignKey('self', related_name='parent_account', on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)

    code = models.CharField("编码", max_length=200, blank=True, null=True, default='')
    phone = models.CharField("手机号", max_length=200, blank=True, null=True, default='')
    nickname = models.CharField("昵称", max_length=200, blank=True, null=True, default='')
    realname = models.CharField("姓名", max_length=200, blank=True, null=True, default='')
    openid = models.CharField("openid", max_length=200, blank=True, null=True, default='')

    class Meta:
        verbose_name = 'Account'
        verbose_name_plural = verbose_name
